package com.ndp.fb.rdb.db.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.ndp.fb.rdb.api.EcProductElementStyleGroupRdbService;
import com.ndp.fb.rdb.db.DaoTemplate;
import com.ndp.fb.rdb.db.impl.mapper.DefaultRowMapper;
import com.ndp.fb.rdb.model.ectemplate.EcElementStyle;
import com.ndp.fb.rdb.model.ectemplate.EcProductElementStyleGroup;

/**
 * Created by sisi.chen on 2016/7/12.
 */
@Service
public class EcProductElementStyleGroupRdbServiceImpl extends DaoTemplate implements EcProductElementStyleGroupRdbService {
    @Override
    public EcProductElementStyleGroup findByProductIdAndElementStyleGroupId(Long productId, Integer elementStyleGroupId) {
        String sql = "select * from ec_product_element_style_group where product_id = ? and element_style_group_id = ?";
        return findOne(sql, new Object[]{productId, elementStyleGroupId}, DefaultRowMapper.autoRowMapper(EcProductElementStyleGroup.class));
    }

    @Override
    public Long save(EcProductElementStyleGroup ecProductElementStyleGroup) {
        return saveResultId(ecProductElementStyleGroup);
    }
}
